$("#return").click(function(){
	window.location.href="../studentorder/oder.html";
});
$(".btn_comfirm").click(function(){
	var order_id = localStorage.order_id;
	var token=localStorage.phone;
	var str='';
	$('.reason').each(function(){
		if($(this).prop('checked')){
			str+=$(this).parent().parent().parent().find('span').html()+",";
		}
	})
	str+=$('#content').val();
	if(str==''){
		layer.msg("请输入取消理由");
		return false;
	}
	$.ajax({
		url:"https://newapp.icandrive.cn/api/cancle.php",
		dataType:'json',
		type:'post',
		data:{token:token,order_id:order_id,content:str},
		success:function(data){

			if(data.status==250){
				layer.msg("重新登录");
				setInterval(function(){
					window.location.href="../login/log_in.html";
				},2000);
			}
			if(data.status==200){
//				localStorage.removeItem("user_id");
//				localStorage.removeItem("teacher_id");
				localStorage.removeItem("order_id");
				layer.msg("取消成功");
				setInterval(function(){
					window.location.href="../studentorder/oder.html";
				},2000);

			}
			if(data.status==400){
				layer.msg("操作失败");
				return false;
			}
		},
		error:function(){
			 layer.msg('系统繁忙');
		}


	});
	$(this).unbind();
});
